package cn.edu.dgut.css.springboottestthree.result;

import java.util.HashMap;

/**
 * @date: 2020/11/16 17:08
 * @author: ZkhEight
 */
public class AjaxResult
{
    private HashMap<String, Object> data;


    public HashMap<String, Object> getData() {
        return data;
    }

    public void setData(HashMap<String, Object> data) {
        this.data = data;
    }

    public static AjaxResult success(Object o){
        AjaxResult ajaxResult = new AjaxResult();
        HashMap<String, Object> data = new HashMap<>();
        data.put("code", "200");
        data.put("region", o);
        ajaxResult.setData(data);
        return ajaxResult;
    }


    public static AjaxResult fail(){
        AjaxResult ajaxResult = new AjaxResult();
        HashMap<String, Object> data = new HashMap<>();
        data.put("code", "500");
        ajaxResult.setData(data);
        return ajaxResult;
    }

}
